<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>发现-潮聚</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" th:href="@{/css/mui.min.css}"/>
		<link rel="stylesheet" th:href="@{/css/common.css}"/>
		<link rel="stylesheet" th:href="@{/css/icons-extra.css}"/>
		 <style>
		 	.mui-input-row input,.mui-input-row  textarea {margin-bottom:0;}
		 </style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">回复</h1>
		</header>
		<div class="cj-line-20"></div>
			<div class="mui-content">
			<form>
					<div class="mui-input-row" >
						<textarea id="textarea" rows="5" placeholder="内容"  name="topic_content"></textarea>
					</div>
				</form>
				<div class="mui-content-padded" >
						<button id='reg' data-loading-text="提交中"  id="publish" class="mui-btn mui-btn-block mui-btn-primary cj-btn">回复</button>
			</div>
			</div>
		<div class="cj-line-60"></div>
		<div class="cj-line-20"></div>
		<div th:include="common/footer :: nav"></div>
		<script src="/js/mui.min.js"></script>
		<script src="/js/jquery.min.js"></script>
		<script src="/js/common.js"></script>
		<script>
			var tid = getUrlParam("tid");
			$("#publish").click(function(){
					var content = $("#textarea").val();
					if(content ==null||content ==""){
							mui.toast("内容不能为空");
							return;
						}
					
					$.ajax({
							url:"/reply/add",
							data:"reply_content="+content+"&topic.tid="+tid,
							type:'get',
							dataType:'json',
							beforeSend:function(){
								mui("#publish").button('loading');
							},
							success:function(response){
								if(response.code==200){
										mui.toast("发表成功");
										location.href="/topic/detail?tid="+tid;
								}
								mui("#publish").button('reset');
					}
				});
			});
		</script>
	</body>
</html>